﻿function getFoods() {
	var url = 'index.php/getFood/get';
	$.get(url, function(result) {
		var re = eval("(" + result + ")");
		alert(re);
	});
}

/**
 * 获取页面显示区域高度
 */
function getWindowHeight() {
	if ($.browser.msie) {
		return document.compatMode == "CSS1Compat" ? document.documentElement.clientHeight : document.body.clientHeight;
	}
	else {
		return self.innerHeight;
	}
}

/**
 * 地理点
 * 
 * @param lat 经度
 * @param log 纬度 
 */
function GeoPoint(lat, log) {
	this.log = log;
	this.lat = lat;
}
GeoPoint.prototype = {
	/**
	 * 判断点对象是否为空
	 */
	isEmpty: function() {
		if(!this.log || !this.lat) {
			return true;
		}
		return false;
	}
}

/**
 * 美食
 *
 * @param opt 初始化参数：{location: new GeoPoint(),  describe: "", imageSrc:"", updateTime:""}
 */
function Cate(opt) {
	this._paramFilter(opt);
	
	/**美食的位置信息*/
	this.location = opt.location;
	
	/**美食描述*/
	this.describe = opt.describe;
	
	/**图片相对地址*/
	this.imageSrc = opt.imageSrc;
	
	/**美食更新时间*/
	this.updateTime = opt.updateTime;
}
Cate.prototype = {
	/**
	 * 初始参数处理
	 */
	_paramFilter: function(opt) {
		if(opt.location.isEmpty()) {
			opt.location = new GeoPoint();
		}
		if(!opt.describe) {
			opt.describe = '';
		}
		if(!opt.imageSrc) {
			opt.imageSrc = '';
		}
		if(!opt.updateTime) {
			opt.updateTime = '';
		}
	}
}